home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tool-inc.zip / REPLSTR.INC < prev    next >
Text File  |  1990-02-25  |  785b  |  29 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. procedure replace_string( var line: string; oldstr, newstr: anystring);
  14.    (* perform string replacement if possible *)
  15. var
  16.    k: integer;
  17.    max: integer;
  18. begin
  19.    max := 10;
  20.    k := pos(oldstr,line);
  21.    while (k <> 0) and (max > 0) do
  22.    begin
  23.       line := copy(line,1,k-1) + newstr + copy(line,k+length(oldstr),255);
  24.       k := pos(oldstr,line);
  25.       dec(max);
  26.    end;
  27. end;
  28.  
  29.